<template>
	<view class="page">
		<view class="my_top">
			<view class="my_top_1">
				<image class="avatar" src="../../static/d_avatar.png"></image>
				<view class="name">{{userInfo.username}}</view>
			</view>
			<view class="my_top_item">
				部门：{{userInfo.department}}
			</view>
			<view class="my_top_item">
				工号：{{userInfo.jobid}}
			</view>
			<view class="my_top_item">
				电话：{{userInfo.phone}}
			</view>
		</view>
		<view class="my_box" style="margin-top: 40rpx;">
			<view class="my_box_item" @click="m_pwd">
				<view class="my_box_item_left">修改密码</view>
				<view class="my_box_item_right">
					<u-icon name="arrow-right" color="rgb(148, 146, 146)" size="18"></u-icon>
				</view>
			</view>
		</view>

		<view class="exit" @click="exit">退出登录</view>
		<bottom c_value="5" ref="bot"></bottom>
	</view>
</template>

<script>
	import {
		api,
		apiBaseUrl,
		http
	} from '@/config/common.js'
	import bottom from '@/components/bottom.vue'
	export default {
		data() {
			return {
				userInfo:{}
			}
		},
		components: {
			bottom
		},
		filters: {},
		mounted() {
			this.$refs.bot.getDot()
		},
		onLoad(e) {
			this.getUserInfo()
			// this.userInfo = uni.getStorageSync('userInfo')
		},
		onShow() {
			
		},
		onPageScroll(e) {},
		beforeDestroy() {},
		methods: {
			getUserInfo() {
				uni.showLoading({})
				api.post('api/shop/user_personal_info', {}).then(res => {
					let rst = res.data
					uni.hideLoading()
					if (rst.code == 1) {
						 uni.setStorageSync('userInfo',rst.data)
					}
					this.userInfo = uni.getStorageSync('userInfo')
				}).catch(err => {
					uni.hideLoading()
				})
			},
			exit(){
				uni.clearStorageSync()
				uni.navigateTo({
					url:'/pages/login/index'
				})
			},
			m_pwd() {
				uni.navigateTo({
					url: '/pages/my/m_pwd'
				})
			},
		}
	};
</script>

<style scoped>
	.exit {
		text-align: center;
		font-size: 26rpx;
		color: rgb(25, 175, 201);
		margin-top: 80rpx;
	}

	.my_box_item {
		display: flex;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		width: 710rpx;
		height: 90rpx;
		margin: 0 auto;
		background-color: rgb(235, 229, 229);
		border-radius: 10rpx;
		margin-top: 20rpx;
		padding: 0 20rpx;
		font-size: 26rpx;
	}

	.my_top_item {
		margin-bottom: 20rpx;
	}

	.my_top_1 {
		display: flex;
		flex-direction: row;
		align-items: center;
		margin-bottom: 40rpx;
	}

	.my_top {
		font-size: 25rpx;
		color: rgb(244, 250, 252);
		background-color: rgb(25, 175, 201);
		width: 710rpx;
		margin: 0 auto;
		border-radius: 10rpx;
		padding: 40rpx 20rpx;
		margin-top: 20rpx;
	}

	.avatar {
		width: 90rpx;
		height: 90rpx;
		border-radius: 100%;
		margin-right: 20rpx;
	}

	page {
		background-color: #fff;
	}
</style>